package com.example.androidlearning2200;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

public class ParamsActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_params);
        // 获取参数
        String who = (String) getIntent().getExtras().get("who");
        String from = (String) getIntent().getExtras().get("from");
        Log.d("ParamsActivity", who + from);

        findViewById(R.id.btnSendMsgBack).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                // 往上一个Activity回传参数
                Intent intent = new Intent();
                Bundle bundle = new Bundle();
                bundle.putString("result", "我是ParamsActivity");
                intent.putExtras(bundle);
                setResult(Activity.RESULT_OK, intent);
                finish();
            }
        });


    }
}